-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react1-week2/gizem #282
base: main
Are you sure you want to change the base?
react1-week2/gizem #282
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🌟 Was a joy to setup your app and see it in action. 😄 Feel free to reach out if you have any questions. 🙂
|
||
useEffect(()=>{ | ||
const timer = setInterval(()=>{ | ||
setSeconds(prevSeconds => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work with the split into minutes and seconds! 🎉 Much more appealing to look at.
There is a small issue with the updater function for seconds: it is not pure! It has a side-effect since it calls setMinutes
. You might have seen when running in development mode, that your minute counter increments twice every time 60 seconds pass. This is due to it running it strict mode where it runs functions supposed to be pure twice to provoke purity issues during development. You can read more here.
Can you think of a way to do this with only one simple state and not two? Then it becomes a lot easier to manager. 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I created one state elapsedTime
. Can you check from my commits:Fix Timer bug
? Thank you for helping with this bug🙏
); | ||
} | ||
|
||
TodoItem.propTypes = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice to set some types and the like so we can catch pesky type errors and missing props! 👍 Deadline
, Task
, and TodoList
are missing them though. They are not required, but consistency is key! 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you🙏 I just used PropTypes for Deadline
, Task
and TodoList
.
} | ||
|
||
const handleRemoveClick = () => { | ||
removeTodo(todo.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of callback patterns! ⭐ I would suggest going with the convention of onSomeAction
to make it clear this is akin to listening to an event in the component.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but React documentation has examples with handleStuff
. Sorry, I couldn't understand what to do🙈
Demo.mov